import cPickle
import pprint

f = '1on5by5_fx_al01_ga09_frew10-2.qtable'

p = cPickle.load(open(f,'rb'))

print "length:",  len(p)

for k, v in p.items():
    # if str(type(v)) == "<type 'float'>" or "<type 'int'>":
    #     print k, ': ',v
    if str(type(v)) == "<type 'dict'>" and len(v) > 1:
        i=0
        strin = ''
        for kk in k:
            if i == 0:
                strin += '['
            strin += str(kk)
            if i < 2:
                strin += ','
                i+=1
            else:
                strin += ']  '
                i=0
        print strin
        strin = ''
        for kk, vv in v.items():
            strin += "%d: %.2f  "%(kk, vv)

        print strin + '\n'
    else:
        print k, v